tools/xenstored: Avoid dereferencing a NULL pointer if LiveUpdate is failing
authorJulien Grall <jgrall@amazon.com>
Fri, 26 Feb 2021 18:26:55 +0000 (18:26 +0000)
committerJulien Grall <jgrall@amazon.com>
Tue, 2 Mar 2021 09:42:21 +0000 (09:42 +0000)
commit29fae90baa14f518407fe7c437d38af768a3134c
tree562b3c6dbe2c0bf880333222afff37689923359a
parent6b4d4dd38470c2293caddf0a5f7034bb832bb574
tools/xenstored: Avoid dereferencing a NULL pointer if LiveUpdate is failing

In case of failure in do_lu_start(), XenStored will first free lu_start
and then try to dereference it.

This will result to a NULL dereference as the destruction callback will
set lu_start to NULL.

The crash can be avoided by freeing lu_start *after* the reply has been
set.

Fixes: af216a99fb4a ("tools/xenstore: add the basic framework for doing the live update")
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Release-Acked-by: Ian Jackson <iwj@xenproject.org>
tools/xenstore/xenstored_control.c